<?php
#基础函数
include_once('_path.php');
include_once("../includes/init.php");
#样式
$css = array();
$js = array();
#菜单
$menu = "company";

#页码
$page = trim($_GET['page']) + 0;
#每页数量
$pagesize = 50;
#获得总页数
$sql = "SELECT count(*) total FROM customers";
$rs = $database->queryArray($sql);
$total_customers= $rs[0]["total"];
$total_page = ceil($total_customers/ $pagesize);
#计算页数
if ($total_page < 1) $total_page = 1;
if ($page < 1) $page = 1;
if ($page > $total_page) $page = $total_page;
#正式读内容
$sql = "SELECT * FROM customers ".
	" LIMIT ".(($page - 1) * $pagesize).", $pagesize";
$rsc = $database->queryArray($sql);

include_once("../layout/_header.php");
?>
<div class="main">
        <div class="traininc-nav-list">
                        <ul>
                                <li class="selected"><a href="javascript:;">企业客户列表</a></li>
                                <li><a href="edit.php?action=add.form">新增企业客户</a></li>

                        </ul>
                </div>
                <div class="box-con">
                <table class="table-blue">
                        <thead>
                                <tr>
                                        <th>编号</th>
                                        <th>企业名称</th>
                                        <th>联系人</th>
                                        <th>联系电话</th>
                                        <th>网点</th>
                                        <th>企业注册号</th>
                                        <th>操作</th>
                                </tr>
                        </thead>
                        <tbody>
                                <?
                                for($i=0;$i<sizeof($rsc);$i++){
                                $r = $rsc[$i];
                                $j = 1;
                                ?>
                                <tr <?=iif($j%2==0, 'class="odd"')?>>
                                        <td><?=$r['id']?></td>
                                        <td><?=$r['company_name']?></td>
                                        <td><?=$r['contact_username']?></td>
                                        <td><?=$r['contact_tel']?></td>
                                          <td><?=$r['region']?></td>
                                        <td><?=$r['company_no']?></td>
                                        <td><a href="edit.php?action=view.form&id=<?= $r['id'] ?>">查看详细</a> | <a href="edit.php?action=delete.do&id=<?= $r['id'] ?>">删除</a></td>
                                </tr>
                                <?
                                $j++;
                                }
                                ?>
                        </tbody>
                </table>

                </div>
</div>
<?
include_once("../layout/_footer.php");
?>